package com.lagou.service.impl;

import com.lagou.dao.IUserDao;
import com.lagou.dao.impl.UserDaoImpl;
import com.lagou.service.IUserService;
import com.lagou.utils.BeanFactory;

<<<<<<< HEAD
public class 2UserServiceimpl implements IUserService {
    public void save(){
        IUserDao userDao = new UserDaoImpl();
=======
public class UserServiceimpl implements IUserService {
    public void save() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
//        调用dao层传统方式：存在编译期依赖：耦合重
//        IUserDao userDao = new UserDaoImpl();

//        反射
//        IUserDao userDao = (IUserDao) Class.forName("com.lagou.dao.impl.UserDaoImpl").newInstance();
        IUserDao userDao = (IUserDao) BeanFactory.getBean("userDao");
>>>>>>> ddd2812 (20221207)
        userDao.save();
    }
}
